<?php
//if(strpos($_SERVER['HTTP_REFERER'], ".swf") != NULL) exit;

if (!defined('TIMESTARTPAGE')) 
{
    define('TIMESTARTPAGE', microtime(true));
}

if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) 
{
    //@ob_start("ob_gzhandler");
}

//load config
@include "includes/config/config.php";

//create object db
@include "includes/class_mysql.php";

include "includes/gpc_function.php";
include "includes/functions.php" ;
include "language/language.php";
include "includes/global.php";

$url        = strtolower(gpc_getStringGet("url"));

//include header class
include("includes/class_html.php");

$html           = new HTML;
$html->ParseUrl($url);
$html->setDomain($root_domain);
$html->setTitleSite($titlesite);

if($html->urlRoot=="as")
{
    $act    = $html->getUrl(1);
    include("source/actions.php");
    exit;
}else if($html->urlRoot=='search')
{
    $module = 'search';
}else
{
    $html->LoadData();    
    $module         = $html->getModule();
}



//include functions of this module:
if(is_file("source/".$module."/functions.php"))
{
    TImport($module);
}

if($popup==true)
{
    @include("source/".$module."/popup.php");
    @include("templates/".$module."/popup.tpl");
    exit;
}
//processes 
if(is_file("source/".$module."/default.php"))
{
    include("source/".$module."/default.php");
}

//insert header html
if($ajax!==true)
{
    include("templates/header.tpl");
}else
{
    include("templates/headerpopup.tpl");
}
//load page
@include("templates/".$module."/default.tpl");

//insert footer html
if($ajax!==true)
{
    @include("templates/footer.tpl");
}else
{
    @include("templates/footerpopup.tpl");
}
?>